﻿using System;

namespace SixthSense
{
    class ConfigOptions
    {
        private bool _Popup;
        private bool _Clipboard;
        private bool _Sound;
        private bool _ChatWindow;
        private bool _TrackValue;
        private bool _TrackRatio;
        private int _MinValue;
        private int _Ratio;
        private bool _TrackPortals;
        private bool _RelativeCoords;
        private bool _IgnoreCorpses;
        private bool _IgnoreHooks;
        private string _ActiveProfile;

        public ConfigOptions Copy()
        {
            return (ConfigOptions)this.MemberwiseClone();
        }

        public bool SetValue(string Name, string Value)
        {
            switch (Name)
            {
                case "popup":
                    if (Value == "true")
                    {
                        _Popup = true;
                    }
                    else
                    {
                        _Popup = false;
                    }
                    break;

                case "clipboard":
                    if (Value == "true")
                    {
                        _Clipboard = true;
                    }
                    else
                    {
                        _Clipboard = false;
                    }
                    break;

                case "sound":
                    if (Value == "true")
                    {
                        _Sound = true;
                    }
                    else
                    {
                        _Sound = false;
                    }
                    break;

                case "chatwindow":
                    if (Value == "true")
                    {
                        _ChatWindow = true;
                    }
                    else
                    {
                        _ChatWindow = false;
                    }
                    break;

                case "relativecoords":
                    if (Value == "true")
                    {
                        _RelativeCoords = true;
                    }
                    else
                    {
                        _RelativeCoords = false;
                    }
                    break;

                case "trackvalue":
                    if (Value == "true")
                    {
                        _TrackValue = true;
                    }
                    else
                    {
                        _TrackValue = false;
                    }
                    break;

                case "trackratio":
                    if (Value == "true")
                    {
                        _TrackRatio = true;
                    }
                    else
                    {
                        _TrackRatio = false;
                    }
                    break;

                case "minvalue":
                    _MinValue = Convert.ToInt32(Value);
                    if (_MinValue < 1000)
                    {
                        _MinValue = 1000;
                    }
                    break;

                case "ratio":
                    _Ratio = Convert.ToInt32(Value);
                    if (_Ratio < 10)
                    {
                        _Ratio = 10;
                    }
                    break;

                case "trackportals":
                    if (Value == "true")
                    {
                        _TrackPortals = true;
                    }
                    else
                    {
                        _TrackPortals = false;
                    }
                    break;

                case "ignorecorpses":
                    if (Value == "true")
                    {
                        _IgnoreCorpses = true;
                    }
                    else
                    {
                        _IgnoreCorpses = false;
                    }
                    break;

                case "ignorehooks":
                    if (Value == "true")
                    {
                        _IgnoreHooks = true;
                    }
                    else
                    {
                        _IgnoreHooks = false;
                    }
                    break;

                case "activeprofile":
                    _ActiveProfile = Value;
                    break;
            }
            return true;
        }

        public string GetValue(string Name)
        {
            switch (Name)
            {
                case "popup":
                    if (_Popup == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "clipboard":
                    if (_Clipboard == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "sound":
                    if (_Sound == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "chatwindow":
                    if (_ChatWindow == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "relativecoords":
                    if (_RelativeCoords == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "trackvalue":
                    if (_TrackValue == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "trackratio":
                    if (_TrackRatio == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "minvalue":
                    return _MinValue.ToString();

                case "ratio":
                    return _Ratio.ToString();

                case "trackportals":
                    if (_TrackPortals == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "ignorecorpses":
                    if (_IgnoreCorpses == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "ignorehooks":
                    if (_IgnoreHooks == true)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }

                case "activeprofile":
                    return _ActiveProfile;
            }
            return "";
        }

        public string ActiveProfile
        {
            get
            {
                return _ActiveProfile;
            }
            set
            {
                _ActiveProfile = value;
            }
        }

        public bool Popup
        {
            get
            {
                return _Popup;
            }
            set
            {
                _Popup = value;
            }
        }

        public bool Clipboard
        {
            get
            {
                return _Clipboard;
            }
            set
            {
                _Clipboard = value;
            }
        }

        public bool Sound
        {
            get
            {
                return _Sound;
            }
            set
            {
                _Sound = value;
            }
        }

        public bool ChatWindow
        {
            get
            {
                return _ChatWindow;
            }
            set
            {
                _ChatWindow = value;
            }
        }

        public bool TrackValue
        {
            get
            {
                return _TrackValue;
            }
            set
            {
                _TrackValue = value;
            }
        }

        public bool TrackRatio
        {
            get
            {
                return _TrackRatio;
            }
            set
            {
                _TrackRatio = value;
            }
        }

        public int MinValue
        {
            get
            {
                return _MinValue;
            }
            set
            {
                _MinValue = value;

                if (_MinValue < 1000)
                {
                    _MinValue = 1000;
                }
            }
        }

        public int Ratio
        {
            get
            {
                return _Ratio;
            }
            set
            {
                _Ratio = value;

                if (_Ratio < 10)
                {
                    _Ratio = 10;
                }
            }
        }

        public bool RelativeCoords
        {
            get
            {
                return _RelativeCoords;
            }
            set
            {
                _RelativeCoords = value;
            }
        }

        public bool TrackPortals
        {
            get
            {
                return _TrackPortals;
            }
            set
            {
                _TrackPortals = value;
            }
        }

        public bool IgnoreCorpses
        {
            get
            {
                return _IgnoreCorpses;
            }
            set
            {
                _IgnoreCorpses = value;
            }
        }

        public bool IgnoreHooks
        {
            get
            {
                return _IgnoreHooks;
            }
            set
            {
                _IgnoreHooks = value;
            }
        }
    }
}
